<template>
	<!-- 兑换订单 -->
	<view class="exchangeorderr_wp">
		<view class="e_list">
			<!-- <view class="e_item" v-for="item in 2" :key="item.id"
				@click="$navTo('../order/detailsx?id='+item.id)">
				<view class="e_itee_head">
					<view>小字路通衣舍</view>
					<view class="e_tag tag_black">抖音</view>
				</view>
				<view class="e_itee_body">
					<image src="https://img.jinghushi.com/images/9/2024/01/I2EnT51X12451Pt1t4Z5Tzn5n4j111.jpeg" mode=""></image>
					<view class="e_itee_name">
						<view class="e_itee_title clamp">育之聪孕妇产检胎心监护带胎监绑带医院同款推荐胎心监护胎心监测</view>
						<view class="e_order"><text class="clamp">交易编号：SH20240124183754666272</text><view class="e_copy" @click="copy(item.ordersn)">复制</view></view>
					</view>
					<view class="e_itee_status">
						<view class="e_item_str">待发货</view>
						<view>已付款</view>
					</view>
				</view>
				<view class="e_price">
					<view class="e_price_item">
						<view>实付</view>
						<view class="e_price_money">￥9.99</view>
					</view>
					<view class="e_price_item">
						<view>预估收益</view>
						<view class="e_price_money">￥5.2</view>
					</view>
				</view>
				<view class="e_tips">付款时间：2024-05-16</view>
				<view class="e_tips">收货后15天收益到账</view>
			</view> -->
			<view class="e_item" v-for="(item,idx) in list" :key="item.id">
				<view class="e_itee_head">
					<view>{{item.mallname}}</view>
					<view class="e_tag tag_black" v-if="item.ptype==1">抖音</view>
					<view class="e_tag tag_red" v-if="item.ptype==2">拼多多</view>
				</view>
				<view class="e_itee_body">
					<image :src="item.thumb" mode=""></image>
					<view class="e_itee_name">
						<view class="e_itee_title clamp">{{item.goodstitle}}</view>
						<view class="e_order"><text class="clamp">交易编号：{{item.ordersn}}</text><view class="e_copy" @click.stop="copy(item.ordersn)">复制</view></view>
					</view>
					<view class="e_itee_status">
						<view class="e_item_str">{{item.statusstr}}</view>
						<view v-if="item.status==-1">已退款</view>
						<view v-else>已付款</view>
					</view>
				</view>
				<view class="e_price">
					<view class="e_price_item">
						<view>实付</view>
						<view class="e_price_money">￥{{item.price}}</view>
					</view>
					<view class="e_price_item">
						<view>预估收益</view>
						<view class="e_price_money">￥{{item.money}}</view>
					</view>
				</view>
				<view class="e_tips">付款时间：{{item.paytime}}</view>
				<view class="e_tips">收货后15天收益到账</view>
			</view>
		</view>
		<view class="loading_message">
			<image v-show="isloading" src="@/static/business/loading.gif" mode=""></image>
			<text v-show="!ismore">到底了~</text>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'myorder',
		props: {
			list: {
				type: Array,
				default: () => []
			},
			isloading: {
				type: Boolean,
				default: false
			},
			ismore: {
				type: Boolean,
				default: true
			}
		},
		data() {
			return {
				active: 1,
			}
		},
		methods: {
			copy(val){
				uni.setClipboardData({
					data: val,
					success: function () {}
				});
			},
			cancelOrder(v, idx) {
				this.$axios('Op/cancel', 'POST', 'order', {
					orderid: v
				}).then(res => {
					if (res.data.code == 200) {
						let list = [...this.list];
						list.splice(idx, 1);
						this.$emit('update:list', list);
						this.$api.msg('已取消订单！');
					}
				})
			},
			goodstap( orderid,idx) {
				var that = this;
				that.$axios('op/complete', "POST", 'order', {
					orderid:orderid
				}).then(res => {
					if (res.data.code == 200) {
						let list = [...this.list];
						list.splice(idx, 1);
						this.$emit('update:list', list);
						this.$api.msg('已确认收货！');
					}
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	page {
		background-color: #f2f2f2;
		color: $font-color-dark;
		padding-bottom: 130rpx;
	}

	.e_nav {
		background-color: #fff;
		display: flex;
		align-items: center;
		line-height: 100rpx;
		position: fixed;
		width: 100%;
		z-index: 100;
		view {
			flex: 1;
			text-align: center;
			font-size: $font-base;
			position: relative;
		}
		&::after{
			content: '';
			border-bottom: 3px $base-color solid;
			position: absolute;
			left: 50%;
			transform: translateX(-50%);
			bottom: 20rpx;
			width: 40rpx;
		}
	}
	.e_list {
		overflow: hidden;
		.e_item {
			background-color: #fff;
			border-radius: 10rpx;
			margin: 20rpx 20rpx 0;
			padding: 20rpx;
			.e_itee_head {
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-weight: bold;
				.e_tag{
					border-radius: 5rpx;
					color: #fff;
					font-size: 16rpx;
					width: 56rpx;
					height: 34rpx;
					text-align: center;
					line-height: 34rpx;
					font-weight: normal;
				}
				.tag_red{
					background: #f40009;
				}
				.tag_black{
					background: #141414;
				}
			}
			.e_itee_body {
				display: flex;
				align-items: center;
				justify-content: space-between;
				align-items: flex-start;
				padding: 14rpx 0;
				image {
					border-radius: 10rpx;
					width: 120rpx;
					height: 120rpx;
				}
				.e_itee_name {
					color: #666;
					width: calc(100% - 230rpx);
					font-size: 28rpx;
					padding-left: 6rpx;
					.e_itee_title {
						font-size: 30rpx;
						color: #000;
						font-weight: bold;
						margin-bottom: 20rpx;
					}
					.e_order{
						display: flex;
						align-items: center;
						.e_copy{
							width: 80rpx;
							font-size: 22rpx;
							border-radius: 6rpx;
							border: 1rpx solid #d6d6d6;
							text-align: center;
							padding: 5rpx;
						}
					}
				}
				.e_itee_status{
					width: 120rpx;
					color: #666;
					font-size: 24rpx;
					text-align: right;
					white-space: nowrap;
					.e_item_str{
						color: #baa05c;
						margin-bottom: 26rpx;
					}
				}
			}
			.e_price{
				display: flex;
				justify-content: space-evenly;
				background: #f4f4f4;
				padding: 20rpx 0;
				color: #848484;
				text-align: center;
				.e_price_money{
					margin-top: 10rpx;
					color: #000;
					font-size: 30rpx;
				}
			}
			.e_tips{
				color: #848484;
				font-size: 24rpx;
				line-height: 1.4;
				margin-top: 10rpx;
			}
		}
	}
	.loading_message {
		color: #0062CC;
		padding: 20rpx;
		text-align: center;
	}

	.loading_message image {
		height: 50rpx;
		width: 50rpx;
	}
</style>